# 继承
# 单继承语法:class 类名 (父类名)
#           类内容体
# 多继承语法:class 类名 (父类1,父类2,...,父类n)
#           类内容体
# 注意:多继承对于同名成员属性的时候先继承的优先级高于后继承的优先级

# 演示单继承
class Phone:
    IMEI = None     # 序列号
    producer = "xj" # 厂商

    def call_by_4g(self):
        print("4g 通话")

# 继承 Phone
class Phone2022(Phone):
    face_id = "100001"      # 面部识别

    def call_by_5g(self):
        print("5g 通话")

phone = Phone2022()
phone.call_by_4g()
phone.call_by_5g()
print(phone.IMEI)
print(phone.producer)


# 演示多继承
class NFCReader:        # NFC 类
    nfc_type = "第五代"
    producer = "xj"

    def read_card(self):
        print("NFC 读卡")

    def write_card(self):
        print("NFC 写卡")

class RemoteControl:        # 红外遥控功能
    rc_type = "红外"

    def control(self):
        print("红外遥控开启了")

class MyPhone(Phone,NFCReader,RemoteControl):
    pass        # 补全语法要求

phone = MyPhone()
phone.call_by_4g()
phone.read_card()
phone.write_card()
phone.control()

